Release 10.1A: OpenEdge Development:
Progress 4GL Handbook
Temp-table parameter syntax
The syntax you use to pass a temp-table as a parameter is special in order to identify the temp-table to Progress. In the calling routine, you define the parameter in the
RUNstatement with this syntax:
If you’re passing a temp-table as a parameter to another routine, you must add the
TABLEkeyword before the temp-table name. As with other parameter types, the default direction of the parameter isINPUT.An
INPUTparameter moves data from the calling routine to the called routine at the time of theRUNstatement. AnOUTPUTparameter moves data from the called routine to the calling routine when the called routine terminates and returns to its caller. AnINPUT-OUTPUTparameter moves data from the calling routine to the called routine at the time of theRUN, and then back to the calling routine when the called routine ends.If you use the
APPENDoption for anOUPUTorINPUT-OUTPUTtemp-table, then the records passed back from the called routine are appended to the end of the data already in the temp-table in the calling routine. Otherwise, the new data replaces whatever the contents of the temp-table were at the time of the call.If you use the
BY-REFERENCEoption, the calling routine and the called routine access the same temp-table instance. That is, both routines access the calling routine’s instance and ignore the called routine’s instance.If you use the
BINDoption, a temp-table defined as reference-only in one routine binds to a temp-table instance defined and instantiated in another local routine.In the called routine, you must define temp-table parameters in this way for an
INPUTorINPUT-OUTPUTtable:
Once again,
INPUTis the default. If you use theAPPENDoption for anINPUTorINPUT-OUTPUTtemp-table parameter to a called routine, then the records passed in from the calling routine are appended to the end of the data already in the local temp-table. Otherwise, the new data replaces whatever the contents of the temp-table were at the time of the call.For an
OUTPUTtemp-table parameter returned from a called routine, use this syntax:
You must define the temp-table in both routines. The temp-table definitions must match with respect to the number of fields and the data type of each field (including the array extent if any). The field data types make up what is called the signature of the table.
Other attributes of the tables can be different. The field names do not have to match. The two tables do not need to have matching indexes, because Progress dynamically builds the appropriate indexes for the table when it is instantiated either as an
INPUTparameter in the called routine or as anOUTPUTparameter in the calling routine. Other details, such as field labels and formats, also do not have to match.You can pass a temp-table parameter by value, by reference, or by binding. The next sections describe how to decide which option to use based on how you want to pass the temp-table data. Some of this material includes references to running internal procedures in persistent procedure handles. Internal procedures were explained in Chapter 3, "Running Progress 4GL Procedures," and persistent procedures are explained in more detail in Chapter 13, " Advanced Use of Procedures in Progress."
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |